package com.hera.process.config.service.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hera.base.util.FiltroDTO;
import com.hera.process.config.dao.ParameterDao;
import com.hera.process.config.dao.ProcessGroupDao;
import com.hera.process.config.dao.ProcessGroupUserDao;
import com.hera.process.config.dao.SysUserDao;
import com.hera.process.config.dao.UserDao;
import com.hera.process.config.service.ProcessGroupService;
import com.hera.process.workflow.domain.ProcessGroup;

@Service("processgroupService")
public class ProcessGroupServiceImpl implements ProcessGroupService {

	
	static final Logger logger = Logger.getLogger(ProcessGroupServiceImpl.class);

	@Autowired
	private ProcessGroupDao processgroupDao;
	
     @Autowired
     private ProcessGroupUserDao processGroupUserDao;
	/**
	 * 
	 */
	public ProcessGroupServiceImpl() {
		
	}


	@Override
	public ProcessGroup findById(Long id) {
		
		return processgroupDao.findOne(id);
	}

	@Override
	public void update(ProcessGroup entity) {
		
		processgroupDao.save(entity);
	}

	@Override
	public void save(ProcessGroup entity) {
		
		processgroupDao.save(entity);
	}

	@Override
	public void delete(ProcessGroup entity) {
		
        processGroupUserDao.deleteByProcessGroup(entity.getIdProcessGroup());
		processgroupDao.delete(entity);
	}

	@Override
	public List<ProcessGroup> findAll() {
		
		return processgroupDao.findAll();
	}

	@Override
	public List<ProcessGroup> findAll(FiltroDTO filtroDTO) {
		
		return processgroupDao.obtenerEntidadesPorFiltros(filtroDTO);
	}

}
